#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPushButton>
#include <QDebug>
#include <QProgressDialog>



MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //通过按钮获取到进度条对话框，然后在窗口中显示出来
    QPushButton* button = new QPushButton("打开进度条对话框",this);
    QProgressDialog* pdialog = new QProgressDialog(this);
    connect(button,&QPushButton::clicked,[=](){
        pdialog->setWindowTitle("进度条对话框");   //设置窗口标题
        pdialog->setLabelText("Current progress...");   //设置文本
        pdialog->setMaximum(100);   //设置最大值
        pdialog->setMinimum(0);    //设置最小值
        pdialog->setValue(10);    //设置当前值
        pdialog->exec();
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

